package utils;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;

public class MyBatisUtils {
    //获取sqlSession工厂
    private static SqlSessionFactory sessionFactory;
    //    获取绑定当前线程的对象
    private static final ThreadLocal<SqlSession> tl = new ThreadLocal<>();
    static {
        try {
            InputStream in = Resources.getResourceAsStream("mybatis-config.xml");
            sessionFactory = new SqlSessionFactoryBuilder().build(in);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
//    获取连接
private static SqlSession session() {

}

}
